class Actor
  class << self
    def each_collision(actor, options={}, &block)
      @actors.each do |actor2|
        next if actor == actor2
        next if options[:classes] and !options[:classes].include? actor2.class
        next if options[:ignore] and !options[:ignore].include? actor2
        next if actor.left > actor2.right
        next if actor.right < actor2.left
        next if actor.top > actor2.bottom
        next if actor.bottom < actor2.top
        yield actor2
      end
    end
  end

  def each_collision(options={}, &block)
    Actor.each_collision self, options, &block
  end
end
